package com.spsy.order.controller.api;


import com.spsy.api.order.OrderApi;
import com.spsy.common.core.domain.R;
import com.spsy.order.domain.Order;
import com.spsy.order.service.IOrderService;
import com.spsy.vo.NotifyPay2OrderVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: liuzhiping
 * @date: 2025/9/22 16:23
 **/
@RestController
@Slf4j
public class OrderApiController implements OrderApi {

    @Autowired
    private IOrderService iOrderService;
    @Override
    public R createOrder(NotifyPay2OrderVo notifyPay2OrderVo) throws Exception {


        System.out.println("2302a");

        //先要判断状态是是已经支付。

        //通过订单号，去修改状态 200ms
        int count = this.iOrderService.updateOrder(Order.builder().orderStatus(notifyPay2OrderVo.getStatus()).orderNo(notifyPay2OrderVo.getOrderId()).build());

        Thread.sleep(30000);

        log.info("count:{}",count);
        return R.ok();
    }
}
